valid = true;

function check_mail(){
	mail = document.getElementById('mail').value;
	if(/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+.([a-zA-Z])+([a-zA-Z])+/.test(mail) || mail == '' || mail == 'Mail')
	{
		$('#invalid_mail').fadeOut('slow');
		valid = true;
	}
	else
	{
		document.getElementById('invalid_mail').setAttribute('style', 'margin-left:10px; padding:6px; display:inline; padding-left:45px;');
		valid = false;
	}
	for(i=0; i<mails.length; i++)
	{
		if(mail == mails[i])
		{
			document.getElementById('exist_mail').setAttribute('style', 'margin-left:10px; padding:6px; display:inline; padding-left:45px;');
			valid = false;
			break;
		}
		else
		{
			$('#exist_mail').fadeOut('slow');
		}
	}
};

function check_pass2(){
	
	pass1 = document.getElementById('pass').value;
	pass2 = document.getElementById('pass2').value;
	if(!(pass1 == 'Password' || pass2 == 'Ripeti Password'))
	{
		if(pass1 != pass2)
		{
			document.getElementById('diff_pass').setAttribute('style', 'margin-left:10px; padding:6px; display:inline; padding-left:45px; z-index:50;');
				valid = false;
		}
		else
			$('#diff_pass').fadeOut('slow');
	}
};



function validate(){
valid = true;
check_mail();
check_pass2();

if(valid)
	document.forms['mod'].submit();

}


